class Caiculator {
    int num1;
    int num2;
    char operator;

    public Caiculator(int num1, int num2, char operator) {
        this.num1 = num1;
        this.num2 = num2;
        this.operator = operator;

    }
    public void outCame() {                 //结果
        if (operator == '+') {
            System.out.println(num1 + num2);
        } else if (operator == '-') {
            System.out.println(num1 - num2);
        } else if (operator == '*') {
            System.out.println(num1 * num2);
        } else{
            System.out.println( (double)num1 / num2);
        }

    }
}

public class Test {
    public static void main(String[] args) {
        Caiculator caiculator1 = new Caiculator(4,2,'+');
        caiculator1.outCame();
        Caiculator caiculator2 = new Caiculator(4,2,'-');
        caiculator2.outCame();
        Caiculator caiculator3 = new Caiculator(4,2,'*');
        caiculator3.outCame();
        Caiculator caiculator4 = new Caiculator(4,2,'/');
        caiculator4.outCame();

    }
}
